<?require_once $_SERVER["DOCUMENT_ROOT"]."/system/core/prolog.php"?>
<?SetTitle("Панель управления :: Типы каталогов");?>
<?IncludeModule('catalog');?>
<?switch ($_GET["ACTION"]):
	case 'ADD':?>
		<h3><?=LANG("MODULE_CATALOG_TYPES_ADD_TITLE")?></h3>
		<?ShowMsg()?>
		<?Component::getComponent("catalog.type.add", 
			"", 
			Array(
				"FIELDS" => Array(
					"ID",
					"NAME",
					"SORT",
					"SID",
					"SECTION_NAME",
					"ELEMENT_NAME"
				),
			)
		);?>
	<?break?>
	<?case 'EDIT':?>
		<h3><?=LANG("MODULE_CATALOG_TYPES_EDIT_TITLE")?></h3>
		<?ShowMsg()?>
		<?Component::getComponent("catalog.type.add", 
			"", 
			Array(
				"FIELDS" => Array(
					"ID",
					"NAME",
					"SORT",
					"SID",
					"SECTION_NAME",
					"ELEMENT_NAME"
				),
				"ID" => $_GET['ID'],
			)
		);?>
	<?break?>
	<?case 'DELETE':?>
		<?ShowMsg()?>
		<?
			if(CatalogType::Delete($_GET["ID"])) {
				AddMsg("Тип успешно удалён");
				RedirectTo('/system/admin/catalog/');
			} else {
				ShowError("Ошибка при удалении типа каталога");
			}
		?>
		<p><a href="/system/admin/catalog/">Список типов</a></p>
	<?break?>
	<?default:?>
	<h3><?=LANG("MODULE_CATALOG_TYPES_TITLE")?></h3>
	<?ShowMsg()?>
	<p>
		<a href="?ACTION=ADD"><?=LANG("MODULE_CATALOG_TYPES_ADD_TEXT")?></a>
	</p>
	<?Component::getComponent("system:catalog.type.list",
		"", 
		Array(
			"SHOW_FIELDS" => Array(
				"ID",
				"NAME",
				"SORT",
				"SID",
				"SECTION_NAME",
				"ELEMENT_NAME"
			),
		)
	);?>
	<?break;?>
<?endswitch?>
<?require_once $_SERVER["DOCUMENT_ROOT"]."/system/core/epilog.php"?>